package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.AOutboundMapper;
import com.ruoyi.system.domain.AOutbound;
import com.ruoyi.system.service.IAOutboundService;

/**
 * 原材出库Service业务层处理
 *
 */
@Service
public class AOutboundServiceImpl implements IAOutboundService 
{
    @Autowired
    private AOutboundMapper aOutboundMapper;

    /**
     * 查询原材出库
     * 
     * @param id 原材出库主键
     * @return 原材出库
     */
    @Override
    public AOutbound selectAOutboundById(Long id)
    {
        return aOutboundMapper.selectAOutboundById(id);
    }

    /**
     * 查询原材出库列表
     * 
     * @param aOutbound 原材出库
     * @return 原材出库
     */
    @Override
    public List<AOutbound> selectAOutboundList(AOutbound aOutbound)
    {
        Long deptId = SecurityUtils.getLoginUser().getDeptId();
        aOutbound.setGroupId(deptId.toString());
        return aOutboundMapper.selectAOutboundList(aOutbound);
    }

    /**
     * 新增原材出库
     * 
     * @param aOutbound 原材出库
     * @return 结果
     */
    @Override
    public int insertAOutbound(AOutbound aOutbound)
    {
        Long deptId = SecurityUtils.getLoginUser().getDeptId();
        aOutbound.setGroupId(deptId.toString());
        return aOutboundMapper.insertAOutbound(aOutbound);
    }

    /**
     * 修改原材出库
     * 
     * @param aOutbound 原材出库
     * @return 结果
     */
    @Override
    public int updateAOutbound(AOutbound aOutbound)
    {
        Long deptId = SecurityUtils.getLoginUser().getDeptId();
        aOutbound.setGroupId(deptId.toString());
        return aOutboundMapper.updateAOutbound(aOutbound);
    }

    /**
     * 批量删除原材出库
     * 
     * @param ids 需要删除的原材出库主键
     * @return 结果
     */
    @Override
    public int deleteAOutboundByIds(Long[] ids)
    {
        return aOutboundMapper.deleteAOutboundByIds(ids);
    }

    /**
     * 删除原材出库信息
     * 
     * @param id 原材出库主键
     * @return 结果
     */
    @Override
    public int deleteAOutboundById(Long id)
    {
        return aOutboundMapper.deleteAOutboundById(id);
    }
}
